<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
	String DRV = "org.mariadb.jdbc.Driver";
	String URL = "jdbc:mariadb://localhost:3306/jwj8508?user=jwj8508&password=123456";	
	String sql = "select * from memberv4 where uid=?";
	
	Connection conn = null;
	PreparedStatement pstmt = null;
	ResultSet rs = null;
%>
<%
	String uid = request.getParameter("uid");
	String mno = null;
	String pwd = null;
	String name = null;
	String rdate = null;
%>
<%
	try {
		Class.forName(DRV);
		conn = DriverManager.getConnection(URL);
		pstmt = conn.prepareStatement(sql);
		pstmt.setString(1, uid);
		rs = pstmt.executeQuery();		
		if (rs.next()) {
			mno = rs.getString("mno");
			pwd = rs.getString("pwd");
			name = rs.getString("name");
			rdate = rs.getString("rdate");
		}
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		if (rs!=null)try{rs.close();}catch(Exception e){}
		if (pstmt!=null)try{pstmt.close();}catch(Exception e){}
		if (conn!=null)try{conn.close();}catch(Exception e){}
	}
%>
<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>JSP 프로젝트 v1</title>
		<link type="text/css" href="../css/layout.css" rel="stylesheet" />
		<style type="text/css">
			form { width: 270px; margin: 0 auto; }	
			label { font-weight: bold; display: inline-block;
				width: 80px; text-align: right; margin: 0 10px 10px 0; }
		</style>
		
	</head>
	<body>
		<div>
			<h1>JSP 프로젝트 v1</h1> <!-- 제목 -->
			<ul id="nav">
				<li><a href="../index.html">Home</a></li>
				<li><a href="join.html">회원가입</a></li>
				<li><a href="login.html">로그인</a></li>
				<li><a href="../board/list.html">게시판</a></li>
				<li><a href="myinfo.html">회원정보</a></li>
			</ul> <!-- 상단메뉴 -->
			<hr />
		</div> <!-- header -->
		
		<div id="content">
			<h2>회원정보</h2>
			<form id="myinfo" name="myinfo">
				<div>
					<label for="mno">회원번호</label>
					<span name="mno" id="mno"><%=mno %></span>
				</div>
				<div>
					<label for="uid">아이디</label>
					<span name="uid" id="uid"><%=uid %></span>
				</div>
				<div>
					<label for="pwd">비밀번호</label>
					<span name="pwd" id="pwd"><%=pwd %></span>
				</div>
				<div>
					<label for="name">이름</label>
					<span name="name" id="name"><%=name %></span>
				</div>
				<div>
					<label for="regdate">가입일</label>
					<span name="regdate" id="regdate"><%=rdate %></span>
				</div>
			</form>
		</div> <!-- content -->
		
		<div>
			<hr />
			<p id="copy">Copyright &copy; 2013 JINn. All right reserved.</p>
		</div> <!-- footer -->
		
		
	</body>
</html>
